﻿/*
版权所有：版权所有(C) 2011，刘建新
文件编号：M01_Mypayment.cs
文件名称：Mypayment.cs
系统编号：Z0003007
系统名称：通用办公系统
模块编号：M01
模块名称：信息发布
设计文档：IOA_M01信息发布XDE建模.mdx
完成日期：2011-01-10
作　　者：
内容摘要：表[MyPayment]对应的实体类
*/

using System;
using System.Collections;
using System.Data;


namespace Eis51.CampanyCMS.Model.Bus
{
		/// <summary>
		/// 类 编 号：
		/// 类 名 称：Mypayment
		/// 内容摘要：
		/// </summary>
		
		[Serializable]
		public class Mypayment : BaseModel
		{
		#region 自动生成代码
		
			#region 重载Equals/GetHashCode
			/// <summary>
			/// 重载Equals			
			/// </summary>
			public override bool Equals (Object obj)
			{
				if (obj != null && obj is Mypayment)
				{
					if (obj == this)
						return true;
					Mypayment castObj = (Mypayment)obj; 
					
					if (!this.m_Seqno.Equals(castObj.Seqno))
						return false;
						
					if (!this.m_Paycode.Equals(castObj.Paycode))
						return false;
						
					if (!this.m_Content.Equals(castObj.Content))
						return false;
						
					if (!this.m_Createby.Equals(castObj.Createby))
						return false;
						
					if (!this.m_Createdate.Equals(castObj.Createdate))
						return false;
						
					if (!this.m_Paymentno.Equals(castObj.Paymentno))
						return false;
						
					if (!this.m_AlipayPartner.Equals(castObj.AlipayPartner))
						return false;
						
					if (!this.m_AlipayKey.Equals(castObj.AlipayKey))
						return false;
						
					if (!this.m_Paymentname.Equals(castObj.Paymentname))
						return false;
						
					return true;
				}
				return false;
			}
			
			/// <summary>
			/// 重载GetHashCode
			/// </summary>
			public override int GetHashCode()
			{
					int hash = 0;					
					
					hash = hash <<  8;
					if ((object)m_Seqno != null)
					{
						hash = hash ^ m_Seqno.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Paycode != null)
					{
						hash = hash ^ m_Paycode.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Content != null)
					{
						hash = hash ^ m_Content.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Createby != null)
					{
						hash = hash ^ m_Createby.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Createdate != null)
					{
						hash = hash ^ m_Createdate.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Paymentno != null)
					{
						hash = hash ^ m_Paymentno.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_AlipayPartner != null)
					{
						hash = hash ^ m_AlipayPartner.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_AlipayKey != null)
					{
						hash = hash ^ m_AlipayKey.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Paymentname != null)
					{
						hash = hash ^ m_Paymentname.GetHashCode();
					}
						
					return hash; 
			}
			#endregion
			
			public Mypayment()
			{
				MarkNew();
			}						
			
			public Mypayment GetOldValue()
			{
				return OldValue as Mypayment;
			}
		
		#region Seqno属性
			private int m_Seqno = 0;
			/// <summary>
			/// 属性名称： Seqno
			/// 内容摘要： DB列名：Seqno[]
			///            DB类型：int
			/// </summary>
			public int Seqno
			{
				get
					{
						return m_Seqno;
					}
				set
					{
						if (m_Seqno as object == null || !m_Seqno.Equals(value))
						{
							m_Seqno = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Paycode属性
			private string m_Paycode = String.Empty;
			/// <summary>
			/// 属性名称： Paycode
			/// 内容摘要： DB列名：PayCode[]
			///            DB类型：string
			/// </summary>
			public string Paycode
			{
				get
					{
						return m_Paycode;
					}
				set
					{
						if (m_Paycode as object == null || !m_Paycode.Equals(value))
						{
							m_Paycode = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Content属性
			private string m_Content = String.Empty;
			/// <summary>
			/// 属性名称： Content
			/// 内容摘要： DB列名：Content[]
			///            DB类型：string
			/// </summary>
			public string Content
			{
				get
					{
						return m_Content;
					}
				set
					{
						if (m_Content as object == null || !m_Content.Equals(value))
						{
							m_Content = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Createby属性
			private string m_Createby = String.Empty;
			/// <summary>
			/// 属性名称： Createby
			/// 内容摘要： DB列名：CreateBy[]
			///            DB类型：string
			/// </summary>
			public string Createby
			{
				get
					{
						return m_Createby;
					}
				set
					{
						if (m_Createby as object == null || !m_Createby.Equals(value))
						{
							m_Createby = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Createdate属性
			private DateTime m_Createdate = new DateTime(1900,1,1);
			/// <summary>
			/// 属性名称： Createdate
			/// 内容摘要： DB列名：Createdate[]
			///            DB类型：DateTime
			/// </summary>
			public DateTime Createdate
			{
				get
					{
						return DateTime.Parse(m_Createdate.ToString("yyyy-MM-dd HH:mm:ss"));
					}
				set
					{
						if (m_Createdate as object == null || !m_Createdate.Equals(value))
						{
							m_Createdate = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Paymentno属性
			private string m_Paymentno = String.Empty;
			/// <summary>
			/// 属性名称： Paymentno
			/// 内容摘要： DB列名：PayMentNo[]
			///            DB类型：string
			/// </summary>
			public string Paymentno
			{
				get
					{
						return m_Paymentno;
					}
				set
					{
						if (m_Paymentno as object == null || !m_Paymentno.Equals(value))
						{
							m_Paymentno = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region AlipayPartner属性
			private string m_AlipayPartner = String.Empty;
			/// <summary>
			/// 属性名称： AlipayPartner
			/// 内容摘要： DB列名：aliPay_partner[]
			///            DB类型：string
			/// </summary>
			public string AlipayPartner
			{
				get
					{
						return m_AlipayPartner;
					}
				set
					{
						if (m_AlipayPartner as object == null || !m_AlipayPartner.Equals(value))
						{
							m_AlipayPartner = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region AlipayKey属性
			private string m_AlipayKey = String.Empty;
			/// <summary>
			/// 属性名称： AlipayKey
			/// 内容摘要： DB列名：aliPay_Key[]
			///            DB类型：string
			/// </summary>
			public string AlipayKey
			{
				get
					{
						return m_AlipayKey;
					}
				set
					{
						if (m_AlipayKey as object == null || !m_AlipayKey.Equals(value))
						{
							m_AlipayKey = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Paymentname属性
			private string m_Paymentname = String.Empty;
			/// <summary>
			/// 属性名称： Paymentname
			/// 内容摘要： DB列名：PayMentName[]
			///            DB类型：string
			/// </summary>
			public string Paymentname
			{
				get
					{
						return m_Paymentname;
					}
				set
					{
						if (m_Paymentname as object == null || !m_Paymentname.Equals(value))
						{
							m_Paymentname = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region static CreateDataTable/FillDataRow/DataRow2Obj/Dt2Objs/FillDataTable
			/// <summary>
			/// 得到实体对应的DataTable
			/// </summary>
			/// <param name="tableName">表名</param>
			/// <param name="cne">列名映射选择:DB列名或属性名</param>
			/// <returns>生成的DataTable</returns>
			static public DataTable CreateDataTable(string tableName,ColumnNameEnum cne)
			{
				DataTable dtResult = new DataTable(tableName);
			
				if (cne == ColumnNameEnum.DBName)
				{
					dtResult.Columns.Add(new DataColumn("Seqno",typeof(int)));
					dtResult.Columns.Add(new DataColumn("PayCode",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Content",typeof(string)));
					dtResult.Columns.Add(new DataColumn("CreateBy",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Createdate",typeof(DateTime)));
					dtResult.Columns.Add(new DataColumn("PayMentNo",typeof(string)));
					dtResult.Columns.Add(new DataColumn("aliPay_partner",typeof(string)));
					dtResult.Columns.Add(new DataColumn("aliPay_Key",typeof(string)));
					dtResult.Columns.Add(new DataColumn("PayMentName",typeof(string)));
				}
				else if (cne == ColumnNameEnum.PropertyName)
				{
					dtResult.Columns.Add(new DataColumn("Seqno",typeof(int)));
					dtResult.Columns.Add(new DataColumn("Paycode",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Content",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Createby",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Createdate",typeof(DateTime)));
					dtResult.Columns.Add(new DataColumn("Paymentno",typeof(string)));
					dtResult.Columns.Add(new DataColumn("AlipayPartner",typeof(string)));
					dtResult.Columns.Add(new DataColumn("AlipayKey",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Paymentname",typeof(string)));
				}
				return dtResult;
			}
			
			/// <summary>
			/// 得到实体对应的DataTable
			/// </summary>
			/// <param name="cne">列名映射选择:DB列名或属性名</param>
			/// <returns>生成的DataTable</returns>
			static public DataTable CreateDataTable(ColumnNameEnum cne)
			{
				return CreateDataTable(null,cne);
			}

			/// <summary>
			/// 得到实体对应的DataTable(默认列名映射为属性名)
			/// </summary>
			/// <returns>生成的DataTable</returns>
			static public DataTable CreateDataTable()
			{
				return CreateDataTable(ColumnNameEnum.PropertyName);
			}
			
			/// <summary>
			/// 用当前对象值填充DaraRow
			/// </summary>
			/// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
			/// <param name="cne">dr的列名映射方式:DB列名或属性名</param>
			public void FillDataRow(DataRow dr,ColumnNameEnum cne)
			{
				if (dr == null)
				{
					throw new ArgumentNullException("dr");
				}
				if (ColumnNameEnum.DBName == cne)
				{
					dr["Seqno"] = this.Seqno;
					dr["PayCode"] = this.Paycode;
					dr["Content"] = this.Content;
					dr["CreateBy"] = this.Createby;
					dr["Createdate"] = this.Createdate;
					dr["PayMentNo"] = this.Paymentno;
					dr["aliPay_partner"] = this.AlipayPartner;
					dr["aliPay_Key"] = this.AlipayKey;
					dr["PayMentName"] = this.Paymentname;
				}
				else if (ColumnNameEnum.PropertyName == cne)
				{
					dr["Seqno"] = this.Seqno;
					dr["Paycode"] = this.Paycode;
					dr["Content"] = this.Content;
					dr["Createby"] = this.Createby;
					dr["Createdate"] = this.Createdate;
					dr["Paymentno"] = this.Paymentno;
					dr["AlipayPartner"] = this.AlipayPartner;
					dr["AlipayKey"] = this.AlipayKey;
					dr["Paymentname"] = this.Paymentname;					
				}
			}
			
			/// <summary>
			/// 用当前对象值填充DaraRow(默认列名映射为属性名)
			/// </summary>
			/// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
			public void FillDataRow(DataRow dr)
			{
				this.FillDataRow(dr,ColumnNameEnum.PropertyName);
			}
			
			/// <summary>
			/// 将DataRow转换成Mypayment对象
			/// </summary>
			/// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
			/// <param name="cne">dr的列名映射方式:DB列名或属性名</param>
			/// <returns>Mypayment对象</returns>
			public static Mypayment Dr2Obj(DataRow dr,ColumnNameEnum cne)
			{
				if (dr == null)
				{
					throw new ArgumentNullException("dr");
				}
				Mypayment obj = new Mypayment();
				if (ColumnNameEnum.DBName == cne)
				{
					obj.Seqno = (dr["Seqno"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["Seqno"],typeof(int));
					obj.Paycode = (dr["PayCode"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["PayCode"],typeof(string));
					obj.Content = (dr["Content"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Content"],typeof(string));
					obj.Createby = (dr["CreateBy"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["CreateBy"],typeof(string));
					obj.Createdate = (dr["Createdate"] == Convert.DBNull) ? new DateTime(1900,1,1)  : (DateTime)Convert.ChangeType(dr["Createdate"],typeof(DateTime));
					obj.Paymentno = (dr["PayMentNo"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["PayMentNo"],typeof(string));
					obj.AlipayPartner = (dr["aliPay_partner"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["aliPay_partner"],typeof(string));
					obj.AlipayKey = (dr["aliPay_Key"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["aliPay_Key"],typeof(string));
					obj.Paymentname = (dr["PayMentName"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["PayMentName"],typeof(string));
				}
				else if (ColumnNameEnum.PropertyName == cne)
				{
					obj.Seqno = (dr["Seqno"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["Seqno"],typeof(int));
					obj.Paycode = (dr["Paycode"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Paycode"],typeof(string));
					obj.Content = (dr["Content"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Content"],typeof(string));
					obj.Createby = (dr["Createby"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Createby"],typeof(string));
					obj.Createdate = (dr["Createdate"] == Convert.DBNull) ? new DateTime(1900,1,1)  : (DateTime)Convert.ChangeType(dr["Createdate"],typeof(DateTime));
					obj.Paymentno = (dr["Paymentno"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Paymentno"],typeof(string));
					obj.AlipayPartner = (dr["AlipayPartner"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["AlipayPartner"],typeof(string));
					obj.AlipayKey = (dr["AlipayKey"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["AlipayKey"],typeof(string));
					obj.Paymentname = (dr["Paymentname"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Paymentname"],typeof(string));		
				}
				
				return obj;
			}
			
			/// <summary>
			/// 将DataRow转换成Mypayment对象(默认列名映射为属性名)
			/// </summary>
			/// <returns>Mypayment对象</returns>
			public static Mypayment Dr2Obj(DataRow dr)
			{
				return Dr2Obj(dr,ColumnNameEnum.DBName);
			}
			
			/// <summary>
			/// 将DataTabe转换成的Mypayment对象集合
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <param name="cne">dt的列名映射方式:DB列名或属性名</param>
			/// <returns>Mypayment对象的集合</returns>
			public static IList Dt2Objs(DataTable dt,ColumnNameEnum cne)
			{
				if (dt == null)
				{
					throw new ArgumentNullException("dt");
				}
				
				ArrayList alResult = new ArrayList();
				
				foreach(DataRow dr in dt.Rows)
				{
					alResult.Add(Dr2Obj(dr,cne));
				}
				
				return alResult;
			}

			/// <summary>
			/// 将DataTabe转换成的Mypayment对象集合(默认列名映射为属性名)
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <returns>Mypayment对象的集合</returns>
			public static IList Dt2Objs(DataTable dt)
			{
				return Dt2Objs(dt,ColumnNameEnum.PropertyName);
			}
			
			/// <summary>
			/// 用objs的Mypayment对象集合填充DataTable
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <param name="objs">Mypayment对象集合</param>
			/// <param name="cne">dt的列名映射方式:DB列名或属性名</param>
			public static void FillDataTable(DataTable dt,IList objs,ColumnNameEnum cne)
			{
				if (dt == null)
				{
					throw new ArgumentNullException("dt");
				}
				if (objs == null)
				{
					throw new ArgumentNullException("objs");
				}
				
				foreach(Mypayment obj in objs)
				{
					DataRow dr = dt.NewRow();
					obj.FillDataRow(dr,cne);
					dt.Rows.Add(dr);
				}
			}

			/// <summary>
			/// 用objs的Mypayment对象集合填充DataTable(默认列名映射为属性名)
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <param name="objs">Mypayment对象集合</param>
			public static void FillDataTable(DataTable dt,IList objs)
			{
				FillDataTable(dt,objs,ColumnNameEnum.PropertyName);
			}
		#endregion
		
		/// <summary>
		/// 取消编辑,恢复到上次有效调用BeginEdit前的状态,并清空保留值
		/// </summary>
		public override void CancelEdit()
		{
			Mypayment old = this.OldValue as Mypayment;
			if (old != null)
			{
					this.Seqno = old.Seqno;
					this.Paycode = old.Paycode;
					this.Content = old.Content;
					this.Createby = old.Createby;
					this.Createdate = old.Createdate;
					this.Paymentno = old.Paymentno;
					this.AlipayPartner = old.AlipayPartner;
					this.AlipayKey = old.AlipayKey;
					this.Paymentname = old.Paymentname;				
				this.OldValue = null;
			}
		}
		
		
		
		
		#region Mypayment实体的内部Key类
			/// <summary>
			/// Mypayment实体的Key类
			/// </summary>
			public sealed class Key
			{
		
				private int m_Seqno;
				public int Seqno
				{
 					get 
					{ 
						 return m_Seqno; 
					}
					set 
					{ 
						m_Seqno = value;
					}
				}
		
				public Key(int pSeqno)
				{
					m_Seqno=pSeqno;

				}
			}
		#endregion
			/// <summary>
			/// 得到实体Mypayment的PK
			/// </summary>
			public Key GetKey()
			{
				return new Key(Seqno);				
			}
			
				
		#endregion
	}
}
